#!/usr/bin/env bash
p="/tmp/data"
DB_USER='root'
DB_PASS='123456'
DB_NAME='viewer'

cd $p;

for f in `ls $p/*.sql`
do
echo $f;
mysql -u $DB_USER -p$DB_PASS -f $DB_NAME -e "source $f";
mv $f $f.done;

done